package net.borlis.errors.providers.implementation.enumbase;

/**
 * @author alex@borlis.net
 */
@Deprecated
public enum ExceptionCodeKeyDictionary {

    e100("100","wrong_user_id"),
    e150("150","user_id_is_not_set"),
    e200("200","vito_does_not_exist"),
    e250("250","vito_id_is_not_set"),
    e300("300","quartz_error"),
    e401("401","service_key_error"),
    e402("402","access_denied"),
    e500("500","unknown_error"),
    e601("601","bank_account_cannot_be_deleted"),
    e602("602","bank_account_cannot_be_updated"),
    e603("603","bank_account_cannot_be_created"),
    e604("604","bank_account_cannot_be_returned"),
    e605("605","bank_account_list_cannot_be_returned"),
    e611("611","credit_card_cannot_be_deleted"),
    e612("612","credit_card_cannot_be_updated"),
    e613("613","credit_card_cannot_be_created"),
    e614("614","credit_card_cannot_be_returned"),
    e615("615","credit_card_list_cannot_be_returned"),
    e621("621","booking_config_cannot_be_returned"),
    e622("622","booking_config_cannot_be_updated"),
    e631("631","countries_list_cannot_be_returned"),
    e632("632","locales_list_cannot_be_returned"),
    e633("633","credit_card_types_list_cannot_be_returned"),
    e634("634","booking_strategies_list_cannot_be_returned"),
    e635("635","hierarchy_levels_list_cannot_be_returned"),
    e641("641","travel_period_cannot_be_deleted"),
    e642("642","last_travel_period_cannot_be_deleted"),
    e643("643","travel_period_cannot_be_returned"),
    e644("644","travel_period_cannot_be_updated"),
    e645("645","travel_period_cannot_be_created"),
    e646("646","travel_periods_list_cannot_be_returned"),
    e651("651","vito_address_cannot_be_deleted"),
    e652("652","vito_address_cannot_be_updated"),
    e653("653","vito_address_cannot_be_created"),
    e654("654","vito_address_cannot_be_returned"),
    e655("655","vito_addresses_list_cannot_be_returned"),
    e661("661","vito_filter_cannot_be_returned"),
    e662("662","vito_cannot_be_configured"),
    e663("663","vito_cannot_be_created"),
    e664("664","vito_active_providers_list_cannot_be_returned"),
    e665("665","vito_providers_list_cannot_be_returned"),
    e666("666","providers_list_cannot_be_returned"),
    e667("667","vitos_list_cannot_be_returned"),
    e668("668","vito_cannot_be_returned"),
    e671("671","provider_booking_info_list_cannot_be_returned"),
    e672("672","provider_booking_info_cannot_be_updated"),
    e681("681","portfolio_settings_cannot_be_returned"),
    e682("682","portfolio_setting_cannot_be_updated"),
    e700("700","illegal_to_state_in_revert_lifecycle_configuration"),
    e710("710","unknown_lifecycle_state"),
    e750("750","lifecycle_state_not_provided"),
    e800("800","state_machine_exception"),
    e900("900","margin_validation_error");

    private String code;
    private String key;

    private ExceptionCodeKeyDictionary(String code, String key) {
        this.code = code;
        this.key = key;
    }

    public String getCode() {
        return code;
    }

    public String getKey() {
        return key;
    }

    public static String findKeyByCode(String code) {
        for (ExceptionCodeKeyDictionary ck : ExceptionCodeKeyDictionary.values()) {
            if (code.equals(ck.getCode())) {
                return ck.getKey();
            }
        }
        throw new IllegalArgumentException("there is no " + code + " element");
    }

}
